# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=wpaperd
pkgver=0.2.0
pkgrel=0
pkgdesc="Wallpaper daemon for Wayland"
url="https://github.com/danyspin97/wpaperd"
license="GPL-3.0-or-later"
arch="all !s390x !riscv64" # blocked by rust/cargo
makedepends="cargo libxkbcommon-dev scdoc"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/danyspin97/wpaperd/archive/$pkgver/wpaperd-$pkgver.tar.gz"
options="!check" # no test suite

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release

	scdoc <man/wpaperd-output.5.scd >man/wpaperd-output.5
}

package() {
	install -Dm755 target/release/wpaperd "$pkgdir"/usr/bin/wpaperd

	install -Dm644 man/wpaperd.1 -t "$pkgdir"/usr/share/man/man1
	install -Dm644 man/wpaperd-output.5 -t "$pkgdir"/usr/share/man/man5

	install -Dm644 completions/$pkgname.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 completions/$pkgname.fish \
		"$pkgdir"/usr/share/fish/completions/$pkgname.fish
	install -Dm644 completions/_$pkgname \
		"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
1350a9a37f931021cb6a9296726af4ff3b7f1c5c58a6604235054292f9196c5afa37fbbbc7843ab850b71c76ee18629a5bfd1273317c5d9302f95a1532a5c9d8  wpaperd-0.2.0.tar.gz
"
